package messages;

import java.io.Serializable;
import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @author Groupe RT-A1
 */
/**
 * Classe abstraite 
 */
public abstract class Message implements Serializable{
	
    public final static long serialVersionUID = 1234567L;

	private String username;
	
	/**
	 * Host du client qui génère le message
	 */
	private String hostName;
	
	/**
	 * @param username nom qui va être associé au nom d'hôte pour former le username
	 * @throws UnknownHostException
	 */
	protected Message(String username) throws UnknownHostException {
		this.username = username; 
		this.hostName = InetAddress.getLocalHost().getHostAddress();
	}
	
	/**
	 * @return username 
	 */
	public String getUsername() {
		return username;
	}
	
	/**
	 * @return hostName 
	 */
	public String getHostName() {
		return hostName;
	}
	
}
